// 屑金币管理
package coin

import "log"

//导入所需定义
type coin struct {
	shuliang int
	id       int
	username string
}

var sb any
var coinm coin

//修改金币数量为x
func (this *coin) Setcoin(x int) {

	if x < 0 {
		log.Fatalf("你是要让 %v 欠款吗", coinm.username)
	}
	this.shuliang = x

}

//获取用户信息
func (this *coin) Gotinfo() (string, int, int) {
	return coinm.username, int(coinm.id), coinm.shuliang
}

//增加金币
func (this *coin) Addcoin(x int) {
	if x < 0 {
		log.Fatalf("请不要在增加api上传 %v ，传入大于等于0的值", x)
	}
	if this.shuliang < 0 {
		log.Fatalf("不能这样！目标用户 %v 的金币数量必须正整数！", coinm.username)

	}
	this.shuliang += x
}

//减去金币
func (this *coin) Removecoin(x int) {
	if x < 0 {
		log.Fatalf("请不要在减少api上传 %v ，传入大于等于0的值", x)
	}
	if this.shuliang < 0 {
		log.Fatalf("不能这样！目标用户 %v 的金币数量必须正整数！", coinm.username)

	}
	this.shuliang -= x
}
